import { createSlice, configureStore } from '@reduxjs/toolkit'

const MainSlice = createSlice({
    name: 'main',
    initialState: {
        players: [],
        chatTextArr: []
    },
    reducers: {
        updatePlayersInStore(state, action) {
            //@ts-ignore
            state.players = action.payload
        },
        addChatText(state, action) {
            //@ts-ignore
            state.chatTextArr.push(action.payload)
        }
    }
})


export const { updatePlayersInStore, addChatText } = MainSlice.actions
const main = MainSlice.reducer

export const store = configureStore({
    reducer: {
        main
    }
})